#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author   : Moty
# @Time     : 2024/1/22 0:07
# @File     : kc16_17.py
# @Project  : jt808
def parse_17_Parameter_Config(body):
    # 解析0x17 参数配置
    data = {
        "交易流水号": f"{body[0:32]}({body[0:32]})",
        "桩编号": f"{body[32:46]}({body[32:46]})",
        "枪号": f"{int(body[46:48], 16)}枪({body[46:48]})",
        "BMS 单体动力蓄电池最高允许充电电压": f"{int(body[48:52],16)/100}V (0~24)({body[48:52]})",
        "BMS 最高允许充电电流": f"{int(body[52:56],16)/10-400}A (-400A偏移量)({body[52:56]})",
        "BMS 动力蓄电池标称总能量": f"{int(body[56:60],16)/10}kWh/位 (0~1000kWh)({body[56:60]})",
        "BMS 最高允许充电总电压": f"{int(body[60:64],16)/10}V({body[60:64]})",
        "BMS 最高允许温度": f"{int(body[64:66],16)-50}ºC(-50ºC偏移量 数据范围:-50ºC~200ºC)({body[64:66]})",
        "BMS 整车动力蓄电池荷电状态(soc)": f"{int(body[66:70],16)/10}%(范围:0%~100%)({body[66:70]})",
        "BMS 整车动力蓄电池当前电池电压": f"{int(body[70:74],16)/10}V(暂定0.1V/位)({body[70:74]})",
        "电桩最高输出电压": f"{int(body[74:78],16)/10}V({body[74:78]})",
        "电桩最低输出电压": f"{int(body[78:82],16)/10}V({body[78:82]})",
        "电桩最大输出电流": f"{int(body[82:86],16)/10-400}A (-400A偏移量)({body[82:86]})",
        "电桩最小输出电流": f"{int(body[86:90],16)/10-400}A (-400A偏移量)({body[86:90]})",
    }
    formatted_data = ""
    for key, value in data.items():
        formatted_data += f"{key}: {value}\n"
    return formatted_data


__all__ = ['parse_17_Parameter_Config']
